package shopping;
import shopping.User;
import java.awt.*;
import java.net.URL;

import shopping.ShoppingCartDaoArrayImpl;
import shopping.GoodsList;
import java.util.Scanner;

import javax.swing.*;
public class Test extends javax.swing.JFrame{

	  public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new NewJFrame().setVisible(true);
            }
        });
    }
		/*****BackGround b = new BackGround();
	
		int flag=0;
		Menu m = new Menu();
		m.register();
		m.login();
		m.user.cart = new CartItemArray();
		m.user.shoppingcart= new ShoppingCartDaoArrayImpl(m.user);
		//m.user.shoppingcart2 = new ShoppingCartDaoListImpl(m.user);
		int n=m.showMenu();
		while(flag==0){
		switch (n) {
		case 1:
			m.user.shoppingcart.Display();
			//m.user.shoppingcart2.Display();
			n=m.nextInt();
			break;
		case 2:
			int s = m.nextInt();
			int num = m.nextInt();
			m.user.shoppingcart.AddGoods(GoodsList.info.get(s).goods, num);
			//m.user.shoppingcart2.AddGoods(GoodsList.info.get(s).goods, num);
			n=m.nextInt();
			break;
		case 3:
			m.user.shoppingcart.RemoveGoods(GoodsList.info.get(m.nextInt()).goods);
			//m.user.shoppingcart2.RemoveGoods(GoodsList.info.get(m.nextInt()).goods);
			n=m.nextInt();
			break;
		case 4:
			m.println("��ӭ�´�ʹ��");
			flag=1;
			break;
		
		}
		}
		******/
		
		/*Scanner sc = new Scanner(System.in);
		GoodsList g = null;
		ShoppingCart s = new ShoppingCart();;
		int n = sc.nextInt();
		for(int i=0;i<n;i++){
			String t = sc.next();
			if(s.goodYoN(t)==false){
				System.out.println("�̳����޸���Ʒ��");
				break;
			}
			else{
				for(int j=0;j<CartItem.cartitem.size();j++){
					if(t.equals(GoodsList.goodsList.get(j).goods.getName()))
						g=GoodsList.goodsList.get(j);
					    s.AddGoods(g.goods, sc.nextInt());
				}
			}

		}
		
		
		String a = sc.next();
		while(!a.equals("exit")){
			switch (a) {
			case "display":
				ShoppingCart.Display();
				a = sc.next();
				break;

			case "addgoods":
				String t = sc.next();
				if(s.goodYoN(t)==false){
					System.out.println("�̳����޸���Ʒ��");
					break;
				}
				else{
					for(int j=0;j<CartItem.cartitem.size();j++){
						if(t.equals(GoodsList.goodsList.get(j).goods.getName()))
							g=GoodsList.goodsList.get(j);
						    s.AddGoods(g.goods, sc.nextInt());
					}
				}
				//s.AddGoods(sc.next(), sc.nextInt());
				System.out.println("add success!");
				a = sc.next();
				break;
			case "delgoods":
				String b = sc.next();
				for(int j=0;j<CartItem.cartitem.size();j++){
					if(b.equals(GoodsList.goodsList.get(j).goods.getName())){
						g=GoodsList.goodsList.get(j);
						s.RemoveGoods(g.goods);
						System.out.println("delete success!");
						break;
					}
						
				}
				
				
				a = sc.next();
				break;
			default:
				a="exit";
				break;
			}
		}
		
		*/
		
		
		//ShoppingCar.Display();
	}



